package nancal.mp.db.mongo.entity.yapi

import nbcp.base.db.annotation.Cn
import nbcp.base.db.annotation.DbEntityGroup
import nbcp.base.db.annotation.DbName
import org.springframework.data.mongodb.core.mapping.Document
import java.io.Serializable


@Cn("组")
@Document
@DbEntityGroup("yapi")
data class group(
    var id: Int = 0,
    var uid: Int = 0,
    var type: String = "",
    @Cn("名称")
    var group_name: String = "",
) : Serializable

@Cn("项目")
@Document
@DbEntityGroup("yapi")
data class project(
    var id: Int = 0,
    var uid: Int = 0,
    var project_type: String = "",
    var group_id: Int = 0,
    var name: String = "",
) : Serializable


@Cn("接口")
@Document
@DbEntityGroup("yapi")
@DbName("interface_cat")
open class api_cat(
    var id: Int = 0,

    @Cn("名称")
    var name: String = "",
    var project_id: Int = 0,
    var uid: Int = 0
) : Serializable

class api_params {
    var _id: String = ""
    var desc: String = ""
    var name: String = ""
    var example: String = ""
}

class api_header{
    var _id:String = ""
    var name:String = ""
    var value:String = ""
    var required:String = ""
}


@Cn("接口")
@Document
@DbEntityGroup("yapi")
@DbName("interface")
open class api(
    var id: Int = 0,
    var uid: Int = 0,
    var catid: Int = 0,
    var catName: String = "",
    var tag: MutableList<String> = mutableListOf(),
    var project_id: Int = 0,
    @Cn("名称")
    var title: String = "",
    var path: String = "",
    var req_body_other: String = "",
    var res_body: String = "",
    var req_params: MutableList<api_params> = mutableListOf(),
    var method:String = "",
    var desc:String = "",
    var req_headers:MutableList<api_header> = mutableListOf(),

) : Serializable

@Cn("用户")
@Document
@DbEntityGroup("yapi")
@DbName("user")
open class user(
    var id: Int = 0,
    var study: Boolean = false,
    var email: String = "",
    var type: String = "site",
    var username: String = "",
    var password: String = "",
    var passsalt: String = "",
    var role: String = "member"
) : Serializable
